<?php

namespace app\service;

use app\service\ByteService;
use app\service\WechatService;

class PlatFormFactory
{
    const WECHAT = 'wechat';
    const BYTE = 'byte';
    const OFFICIAL = 'official';
    const H5 = 'h5';

    const APP = 'app';

    public function create()
    {
        $platform = request()->header('platform', request()->param('platform'));
        switch ($platform) {
            case self::WECHAT:
                return new WechatService();
            case self::BYTE:
                return new ByteService();
            case self::OFFICIAL:
                return new WechatOfficialService();
            case self::H5:
                return new H5Service();
            case self::APP:

            default:
                return new AppService();
            //                abort(400, '该平台没有配置:' . request()->header('platform'));
        }
    }
}